package com.ymt.common.tools;

import java.text.SimpleDateFormat;
import java.util.Date;

public final class DateUtils {
    private static final String PATTERN = "yyyy-MM-dd HH:mm:ss";

    public static final String currentDateTimeToString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(PATTERN);
        return dateFormat.format(new Date());
    }

    public static final String formatDate(Date date) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(PATTERN);
        return dateFormat.format(date);
    }

    public static final String formatDate(Long time) {
        Date date = new Date(time);
        SimpleDateFormat dateFormat = new SimpleDateFormat(PATTERN);
        return dateFormat.format(date);
    }
}
